package com.su.song.myactiviy;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ComponentName;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;

public class ReadActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_read);
        TextView tv_read = findViewById(R.id.tv_read);
        TextView tv_read2 = findViewById(R.id.tv_read2);
        String desc = getString(R.string.Hello);
        tv_read.setText(desc);

        //获取包管理信息
        PackageManager pm = getPackageManager();
        try {
            //获取包管理器中的当前活动的组件的元数据
            ActivityInfo Info = pm.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
            //获取的元数据以bundl形式存在
            Bundle bundle = Info.metaData;
            String metaD = bundle.getString("earth");
            tv_read2.setText(metaD);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}